/**
 * Created by jean.h.ma on 15/04/2018.
 */
import update from 'immutability-helper'

const initialState = {
	message: ''
};

const ACTION_SEND_MESSAGE = "action_send_message";

export function sendMessage(message) {
	return {
		type: ACTION_SEND_MESSAGE,
		payload: message
	};
}

export default function (state = initialState, action = {}) {
	switch (action.type) {
		case ACTION_SEND_MESSAGE:
			return update(state, {
				message: {$set: action.payload}
			})
		default:
			return state;
	}
}